﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Incubator.Controls
{
    public partial class Question : System.Web.UI.UserControl
    {
        string response;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] == null || (int)Session["UserID"] == -1)
                Response.Redirect("main.aspx");

            response = this.QuestionRBL.SelectedValue;

        }
        public void LoadQuestion(webRef.QuizQuestion question)
        {
            this.lblName.Text = question.name;
            this.lblDescription.Text = question.text;
            this.QuestionRBL.Items.Clear();
            foreach (webRef.QuizChoice c in question.choices)
            {
                ListItem li = new ListItem(c.text, c.value);
                this.QuestionRBL.Items.Add(li);
            }
        }
        public string getSelectedValue()
        {
            return response;
        }

        public void Submit()
        {

            //TODO: call answer question on server
            //increment question num by 1 
            
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            //ConfirmLabel.Text = val;

           
        }
    }
}